package
{
	import com.greensock.TweenLite;
	import com.greensock.TweenMax;
	import com.greensock.easing.Quart;
	import com.greensock.plugins.TintPlugin;
	import com.greensock.plugins.TweenPlugin;
	
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	import com.greensock.TimelineMax;
	
	[SWF(height=500,width=500)]
	public class tweentest extends Sprite
	{
		private var _MovLoader:Loader;    //    加载swf文件  
		private var _Skin:MovieClip;    //    指定AS链接  
		private var count:int = 0;
		
		public function tweentest()
		{
			loadMcSWF();
		}
		
		//加载swf  
		private function loadMcSWF():void  
		{  
			_MovLoader = new Loader;  
			
			/*    新建应用程序域    */  
			var context:LoaderContext = new LoaderContext();  
			context.applicationDomain = new ApplicationDomain();  
			
			/*    开始加载swf      */  
			_MovLoader.load(new URLRequest("模拟时钟.swf"),context); 
			
			/*    添加事件响应，在swf加载完毕后再获取里面的资源        */  
			_MovLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete); 
		}  
		
		private function onComplete(e:Event):void  
		{  
			/*    获得加载器的应用程序域    */  
			var domain:ApplicationDomain = (e.currentTarget as LoaderInfo).applicationDomain;
			
			/*    获取指定（biaopan）的AS链接的影片剪辑  */  
			var cls:Class = domain.getDefinition("biaopan") as Class;  
			_Skin = new cls() as MovieClip;   
			
			addChild(_Skin);
			_Skin.x=500;
			_Skin.y=400;
			
			TweenPlugin.activate([TintPlugin]);
			
			var m_tween:TimelineMax = new TimelineMax();
			m_tween.append(TweenMax.from(_Skin, 1.5, {x:330, y:203, scaleX:0.5, scaleY:1.5, rotation:45, alpha:0.2, tint:0x3399ff, ease:Quart.easeInOut}));
			m_tween.append(TweenMax.to(_Skin, 0.5, {x:100, y:200, scaleX:1, scaleY:1, rotation:0, alpha:1}));
			m_tween.append(
				TweenLite.to(_Skin, 0.5, {x:250, y:"50", onUpdate:onupdateOut, onUpdateParams:[_Skin.y], onComplete:function():void{
					TweenLite.to(_Skin, 0.5, {scaleX:0.5, scaleY:0.8, ease:Quart.easeInOut, onComplete:function():void{
						TweenLite.to(_Skin, 0.5, {delay:0.5, alpha:0.2, tint:0xff00ff, onComplete:function():void{
							//TweenLite.killTweensOf(_Skin);}});
							TweenMax.to(_Skin, 1, {repeat:7, yoyo:true, scaleX:1.5, scaleY:1.2, alpha:1, onComplete:function():void{
								TweenMax.killTweensOf(_Skin);
							}});
						}});
					}});
				}})
			);
		}	
		
		public function onupdateOut(outx:int):void
		{
			trace(outx);
		}
	}
}